package com.demo.k8s.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RefreshScope
@RestController
public class ConfigController {

    /**
     * 读取k8s的configmap配置
     */
    @Value("${config.applicationVersion: 0.0.0}")
    private String version;

    /**
     * 读取k8s的secret配置
     */
    @Value("${pwd: 0}")
    private String password;

    @GetMapping("/k8s/version")
    public String getVersion() {
        return version;
    }

    @GetMapping("/k8s/pwd")
    public String getPassword() {
        return password;
    }
}
